using System;
using ErrorLog.ApiClient;
using FogBugzPd.Core;
using log4net;

namespace FogBugzPd.Web.Utils
{
	//Common web utils used on all web apps
	public class ErrorUtils
	{
		private static readonly ILog _log = LogManager.GetLogger(typeof(ErrorUtils));

		public static void HandleException(Exception exception)
		{
			if (EnvironmentConfig.UseErrorLog)
			{
				ErrorLogUtils.AddError(exception, "ForBugzPd error");
			}
			else
			{
				_log.Error("Agent Exception", exception);
			}
		}
	}
}